package utils

import (
	"github.com/mborgerson/GoTruncateHtml/truncatehtml"
)

/*
截断HTML
*/
func HtmlParseSubstr(htmlContent string, length int) string {
	i := len(htmlContent)
	if i == 0 {
		return ""
	}
	if i <= length {
		return htmlContent
	}
	truncatedContent, _ := truncatehtml.TruncateHtml([]byte(htmlContent), length, "...")
	return string(truncatedContent)
}
